package ro.jproject.imc.view;

import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;


public class ShowUniversityDataBase extends JFrame {

	private static final long serialVersionUID = 1L;
	public String id;
	public String facultyName;
	public String addressName;
	public String cnp;
	public String status;

	public static DefaultTableModel model;

	public static JTable table;

	public ShowUniversityDataBase() {

		this.setTitle("University DataBase");
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.setBounds(500, 200, 299, 281);
		this.setSize(582, 331);
		
		Container container = getContentPane();
		getContentPane().setLayout(null);
		JScrollPane scrollPane = new JScrollPane(table);
		scrollPane.setBounds(10, 11, 546, 231);
		container.add(scrollPane);

		JButton removeButton = new JButton("Remove registration");
		removeButton.setBounds(45, 251, 181, 31);
		getContentPane().add(removeButton);

		JButton btnBack = new JButton("Back");
		btnBack.setBounds(331, 251, 181, 31);
		getContentPane().add(btnBack);
		

		btnBack.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				dispose();
				Ums frame = new Ums();
				frame.setVisible(true);
			}
		});

		removeButton.addActionListener(new ActionListener() {

			public void actionPerformed(ActionEvent event) {
				model.removeRow(table.getSelectedRow());
			}
		});
	}
	
	public ShowUniversityDataBase(String id, String facultyName, String addressName) {

		super();

	

		

		this.id = id;
		this.facultyName = facultyName;
		this.addressName = addressName;
		
		model = new DefaultTableModel();
		model.addColumn("Id");
		model.addColumn("Faculty Name");
		model.addColumn("Address Name");
				

		table = new JTable(model);

		

		
		
		

	}
}
